From e33bc6ad24ec2a260cc68cb2f4c0dde3b9ebb421 Mon Sep 17 00:00:00 2001
From: ink <mhogomchungu@gmail.com>
Date: Sun, 12 Nov 2017 18:47:46 +0300
Subject: [PATCH] fix a build issue of some distributions

---
 CMakeLists.txt               | 27 ++++++++++++++++++++++++++-
 zuluCrypt-cli/CMakeLists.txt |  4 ++--
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a2ecc3b9..9743766f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,6 +71,9 @@ endif( NOKDE )
 
 pkg_check_modules( CRYPTSETUP libcryptsetup )
 pkg_check_modules( BLKID blkid )
+pkg_check_modules( DEVMAPPER devmapper )
+pkg_check_modules( UUID uuid )
+
 if ( WITH_PWQUALITY )
 	pkg_check_modules( PWQUALITY pwquality )
 endif ( WITH_PWQUALITY )
@@ -88,6 +91,28 @@ file( WRITE ${PROJECT_BINARY_DIR}/version.h "
 #endif
 \n" )
 
+if( NOT DEVMAPPER_FOUND )
+	message( FATAL_ERROR "ERROR: could not find devmapper package" )
+else( )
+	find_library( devmapper_lib libdevmapper.so )
+	if( NOT devmapper_lib )
+		message( FATAL_ERROR "ERROR: could not find libdevmapper.so" )
+	else()
+		message( STATUS "found libdevmapper library at: ${devmapper_lib}" )
+	endif()
+endif()
+
+if( NOT UUID_FOUND )
+	message( FATAL_ERROR "ERROR: could not find uuid package" )
+else( )
+	find_library( uuid_lib libuuid.so )
+	if( NOT uuid_lib )
+		message( FATAL_ERROR "ERROR: could not find libuuid.so" )
+	else()
+		message( STATUS "found uuid library at: ${uuid_lib}" )
+	endif()
+endif()
+
 if( NOT BLKID_FOUND )
 	message( FATAL_ERROR "ERROR: could not find blkid package" )
 else( NOT BLKID_FOUND )
@@ -106,7 +131,7 @@ else( NOT CRYPTSETUP_FOUND )
 	#add_definitions( "${CRYPTSETUP_CFLAGS}" )
 	find_library( cryptsetup_lib libcryptsetup.so )
 	#set( cryptsetup_lib "${CRYPTSETUP_LIBDIR}/libcryptsetup.so" )
-	MESSAGE( STATUS "libcryptsetup library path: ${cryptsetup_lib}" )
+	MESSAGE( STATUS "found libcryptsetup library at: ${cryptsetup_lib}" )
 
 	if( NOT cryptsetup_lib )
 		message( FATAL_ERROR "ERROR: could not find libcryptsetup.so" )
diff --git a/zuluCrypt-cli/CMakeLists.txt b/zuluCrypt-cli/CMakeLists.txt
index ac8b02d3..aed9033a 100644
--- a/zuluCrypt-cli/CMakeLists.txt
+++ b/zuluCrypt-cli/CMakeLists.txt
@@ -121,9 +121,9 @@
  set_target_properties( zuluCrypt-exe PROPERTIES SOVERSION ${LIB_VERSION} )
 
  if( STATIC_ZULUPLAY )
-	TARGET_LINK_LIBRARIES( zuluCrypt     String StringList Process ${cryptsetup_lib} ${blkid} -lgcrypt zuluplay-static )
+	TARGET_LINK_LIBRARIES( zuluCrypt     String StringList Process ${cryptsetup_lib} ${blkid} ${uuid_lib} ${devmapper_lib} -lgcrypt zuluplay-static )
  else()
-	TARGET_LINK_LIBRARIES( zuluCrypt     String StringList Process ${cryptsetup_lib} ${blkid} ${TCPLAY_LIB} -lgcrypt -lzuluplay )
+	TARGET_LINK_LIBRARIES( zuluCrypt     String StringList Process ${cryptsetup_lib} ${blkid} ${uuid_lib} ${devmapper_lib} ${TCPLAY_LIB} -lgcrypt -lzuluplay )
  endif()
 
  set_target_properties( zuluCrypt PROPERTIES LINK_FLAGS "-pie -Wl,-z,relro -Wl,-z,now" )
